package com.huawei.uikit.widget;

import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.View;
import android.view.View.MeasureSpec;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import o.fmz;
import o.fnc.a;

public class HwColumnFrameLayout extends FrameLayout {
    private float ʼ;
    private int ʽ;
    private int ˊ;
    private fmz ˋ;
    private boolean ˎ;
    private int ˏ;
    private int ॱ;
    private int ᐝ;

    public HwColumnFrameLayout(Context context) {
        this(context, null, 0);
    }

    public HwColumnFrameLayout(Context context, AttributeSet attributeSet) {
        this(context, attributeSet, 0);
    }

    public HwColumnFrameLayout(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        this.ॱ = Integer.MIN_VALUE;
        this.ˏ = Integer.MIN_VALUE;
        this.ˊ = Integer.MIN_VALUE;
        this.ˎ = false;
        this.ˋ = new fmz(context);
        TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, a.ˊ);
        this.ॱ = obtainStyledAttributes.getInteger(a.ˏ, Integer.MIN_VALUE);
        obtainStyledAttributes.recycle();
    }

    public void setColumnType(int i) {
        this.ॱ = i;
        ˏ((ViewGroup) this);
    }

    private void ˏ(ViewGroup viewGroup) {
        int childCount = viewGroup.getChildCount();
        if (childCount == 0) {
            viewGroup.requestLayout();
            viewGroup.invalidate();
            return;
        }
        for (int i = 0; i < childCount; i++) {
            View childAt = viewGroup.getChildAt(i);
            if (childAt instanceof ViewGroup) {
                ˏ((ViewGroup) childAt);
            } else if (childAt != null) {
                childAt.requestLayout();
                childAt.invalidate();
            }
        }
    }

    private void ˎ(Context context) {
        if (this.ˎ) {
            ˊ(getContext());
        } else {
            ˏ(getContext());
        }
    }

    private void ˊ(Context context) {
        this.ˋ.ॱ(this.ॱ);
        this.ˋ.ˊ(context, this.ʽ, this.ᐝ, this.ʼ);
        this.ˏ = this.ˋ.ˊ();
        this.ˊ = this.ˋ.ॱ();
    }

    private void ˏ(Context context) {
        this.ˋ.ॱ(this.ॱ);
        this.ˋ.ˋ(context);
        this.ˏ = this.ˋ.ˊ();
        this.ˊ = this.ˋ.ॱ();
    }

    /* JADX WARNING: inconsistent code. */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    private int ˏ(int r6, int r7, int r8) {
        /*
        r5 = this;
        r4 = 2;
        r1 = 0;
        r2 = r5.getChildCount();
        r0 = 1;
        if (r2 != r0) goto L_0x0049;
    L_0x0009:
        r0 = r5.getContext();
        r5.ˎ(r0);
        r0 = r5.getChildAt(r1);
        r3 = r5.ˏ;
        r0.setMinimumWidth(r3);
        r5.measureChild(r0, r6, r7);
        r0 = r0.getMeasuredWidth();
        r3 = r5.ˏ;
        if (r0 >= r3) goto L_0x003c;
    L_0x0024:
        r3 = r5.ˏ;
        if (r3 >= r8) goto L_0x003c;
    L_0x0028:
        r0 = r5.ˏ;
    L_0x002a:
        if (r2 != r4) goto L_0x003b;
    L_0x002c:
        r5.ॱ = r4;
        r1 = r5.getContext();
        r5.ˎ(r1);
        r1 = r5.ˏ;
        if (r1 >= r8) goto L_0x003b;
    L_0x0039:
        r0 = r5.ˏ;
    L_0x003b:
        return r0;
    L_0x003c:
        r3 = r5.ˊ;
        if (r0 <= r3) goto L_0x0047;
    L_0x0040:
        r3 = r5.ˊ;
        if (r3 >= r8) goto L_0x0047;
    L_0x0044:
        r0 = r5.ˊ;
        goto L_0x002a;
    L_0x0047:
        if (r0 < r8) goto L_0x002a;
    L_0x0049:
        r0 = r1;
        goto L_0x002a;
        */
        throw new UnsupportedOperationException("Method not decompiled: com.huawei.uikit.widget.HwColumnFrameLayout.ˏ(int, int, int):int");
    }

    protected void onMeasure(int i, int i2) {
        int mode = MeasureSpec.getMode(i);
        int size = MeasureSpec.getSize(i);
        switch (this.ॱ) {
            case 0:
            case 2:
            case 3:
            case 4:
                ˎ(getContext());
                if (this.ˏ < size && this.ˏ > 0) {
                    i = MeasureSpec.makeMeasureSpec(this.ˏ, mode);
                }
                super.onMeasure(i, i2);
                return;
            case 1:
                size = ˏ(i, i2, size);
                if (size > 0) {
                    i = MeasureSpec.makeMeasureSpec(size, mode);
                }
                super.onMeasure(i, i2);
                return;
            default:
                super.onMeasure(i, i2);
                return;
        }
    }
}
